package com.bdqn.zhang.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.text.DateFormat;
import java.util.Date;

/**
 * <Description> <br>
 *
 * @author tao<br>
 * @version 1.0<br>
 * @taskId: <br>
 * @createDate 2019/10/15 14:29 <br>
 * @see com.bdqn.zhang.controller <br>
 */
@Controller
public class HelloController {

    @RequestMapping("/hello")
    public String hello(Model m) throws Exception{
        m.addAttribute("now", DateFormat.getDateTimeInstance().format(new Date()));
        if (true) {  //制造必然异常
            throw new Exception("some exception 异常内容！");
        }
        return "hello";  //视图重定向hello.ftl
    }
}
